﻿namespace Cos.Core.Model.Media
{
    using System;

    public class ImageEntry
    {
        /**
         * element part id
         */

        /**
         * Culture code
         */

        /**
         * Is live mode
         */

        /**
         * Image type
         * 
         * @see ImageType
         */

        /**
         * Name of the image
         */

        public string FileName { get; set; }

        public int ImageTypeId { get; set; }

        public bool IsLive { get; set; }

        public string CultureCode { get; set; }

        public int ImageElementPartId { get; set; }

        public int NavId { get; set; }

        /**
         * @return the contentType
         */
        public String GetContentType()
        {

            if (FileName.EndsWith("gif"))
            {
                return "image/gif";
            }
            else if (FileName.EndsWith("jpg") || FileName.EndsWith("jpeg"))
            {
                return "image/jpeg";
            }
            else if (FileName.EndsWith("png"))
            {
                return "image/png";
            }

            return "";
        }

        /**
         * @return the suffix of the file
         */
        public String GetSuffix()
        {
            return FileName.Substring(FileName.LastIndexOf('.'));
        }
    }
}
